package com.sky.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 菜品
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Dish implements Serializable {

    private static final long serialVersionUID = 1L;

    private Long id;

    //菜品名称
    private String name;

    //菜品分类id
    private Long categoryId;

    //菜品价格
    private BigDecimal price;

    //图片
    private String image;

    //描述信息
    private String description;

    //0 停售 1 起售
    private Integer status;

    private LocalDateTime createTime;

    private LocalDateTime updateTime;

    private Long createUser;

    private Long updateUser;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Dish dish = (Dish) o;
        return Objects.equals(name, dish.name) &&
                Objects.equals(categoryId, dish.categoryId) &&
                Objects.equals(price, dish.price) &&
                Objects.equals(image, dish.image) &&
                Objects.equals(description, dish.description) &&
                Objects.equals(status, dish.status) &&
                Objects.equals(createTime, dish.createTime) &&
                Objects.equals(updateTime, dish.updateTime) &&
                Objects.equals(createUser, dish.createUser) &&
                Objects.equals(updateUser, dish.updateUser);
    }

    @Override
    public int hashCode() {

        return Objects.hash(name, categoryId, price, image, description, status, createTime, updateTime, createUser, updateUser);
    }
}
